package com.wavercaz.freeforum.controllers;

import com.wavercaz.freeforum.utils.ResponseResult;
import org.springframework.http.HttpStatus;
import org.springframework.security.core.AuthenticationException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalExceptionController {

    @ExceptionHandler({AuthenticationException.class})
    public ResponseResult loginFail() {
        return new ResponseResult(HttpStatus.UNAUTHORIZED.value(),"登录失败，请检查用户名或密码是否正确");
    }
}
